home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / CMPLTPAS / PUSHPOP.PAS < prev    next >
Pascal/Delphi Source File  |  1988-12-15  |  313b  |  23 lines

  1. PROGRAM PushPop;
  2.  
  3. CONST
  4.   Levels = 5;
  5.  
  6. VAR
  7.   Depth : Integer;
  8.  
  9. PROCEDURE Dive(VAR Depth : Integer);
  10.  
  11. BEGIN
  12.   Writeln('Push!');
  13.   Writeln('Our depth is now: ',Depth);
  14.   Depth := Depth + 1;
  15.   IF Depth <= Levels THEN Dive(Depth);
  16.   Writeln('Pop!')
  17. END;
  18.  
  19.  
  20. BEGIN
  21.   Depth := 1;
  22.   Dive(Depth)
  23. END.